package com.app.service.impl;

import com.alibaba.fastjson.JSON;
import com.app.conf.RedisService;
import com.app.mapper.LiveCompanyMapper;
import com.app.mapper.LiveCompanyPostMapper;
import com.app.mapper.LiveRecordMapper;
import com.app.mapper.LiveVideoMapper;
import com.app.model.*;
import com.app.service.EnterpriseService;
import com.app.service.JobPublishService;
import com.app.service.LiveService;
import com.app.service.LiveVideoService;
import com.app.util.CommonHelp;
import com.app.util.StringTool;
import com.app.vo.LiveVo;
import com.app.vo.WebSocketVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * @Description:直播回放实现类
 * @Author: N
 * @Date: 2022年11月24日 10点29分
 */
@Service
public class LiveVideoServiceImpl implements LiveVideoService {

    @Autowired
    LiveVideoMapper liveVideoMapper;


    @Override
    public void insert(LiveVideoModel model) {
        liveVideoMapper.insert(model);
    }

    @Override
    public LiveVideoModel getModelByRoomNo(String roomNo) {
        QueryWrapper<LiveVideoModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("room_no", roomNo);
        List<LiveVideoModel> modelList = liveVideoMapper.selectList(queryWrapper);
        if (modelList == null && modelList.isEmpty()) {
            return null;
        } else {
            return modelList.get(0);
        }
    }
}
